package com.longcai.piaojia.conn;

import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by Administrator on 2016/8/31.
 */
@HttpInlet(Conn.USER_LOGIN)
public class LoginPost extends BaseAsyPost<LoginPost.LoginPostEntity> {

    public String phone, user_pass;

    public LoginPost(AsyCallBack<LoginPostEntity> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected LoginPostEntity parser(JSONObject object) throws Exception {

        TOAST = object.optString("message");

        if(object.optInt("code")==200){

            JSONObject jsonObject = object.optJSONObject("data");

            LoginPostEntity loginPostEntity = new LoginPostEntity();

            loginPostEntity.user_id = jsonObject.optString("user_id");
            loginPostEntity.group_id = jsonObject.optString("group_id");

            return loginPostEntity;

        }

        return null;
    }

    public static class LoginPostEntity {

        public String user_id, group_id;

    }
}
